Skip to content

Rescan external storage shares on missing metadata - #63254

Open
pdostal wants to merge 1 commit into
nextcloud:masterfrom
pdostal:share_refresh
Open

Rescan external storage shares on missing metadata#63254
pdostal wants to merge 1 commit into
nextcloud:masterfrom
pdostal:share_refresh

Conversation

@pdostal

@pdostal pdostal commented Aug 14, 2026

Copy link
Copy Markdown

Summary

SharedStorage::getWatcher() decided between a real Watcher and a NullWatcher purely from the share's node cache entry storage_string_id. When that metadata was null or missing the key (e.g. shares fetched via DefaultShareProvider::getSharesBy()/getShareById()/getSharesByPath(), or not yet scanned at share-fetch time), it silently assumed home storage and installed a NullWatcher, so re-shares of external storage (SMB, S3, etc.) never got rescanned for the recipient.

This falls back to a live check of the real underlying storage (instanceOfStorage(IHomeStorage::class)) when the metadata is missing or incomplete, mirroring the existing fallback in getSourceRootInfo(). A FailedStorage guard keeps a deleted owner/offline storage safely on NullWatcher.

Manually verified against a real Samba server on a fresh Debian VM: mounted a real SMB share as external storage for one user, shared the folder with a second user, then modified files directly on the SMB backend (bypassing Nextcloud). The recipient's WebDAV listing picked up the changes immediately, no regression from master.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

SharedStorage::getWatcher() decided between a real Watcher and a
NullWatcher purely from the share's node cache entry storage_string_id.
When that metadata was null or missing the key (e.g. shares fetched via
DefaultShareProvider::getSharesBy()/getShareById()/getSharesByPath(), or
not yet scanned at share-fetch time), it silently assumed home storage
and installed a NullWatcher, so re-shares of external storage (SMB, S3,
etc.) never got rescanned for the recipient.

Fall back to a live check of the real underlying storage
(instanceOfStorage(IHomeStorage::class)) when the metadata is missing or
incomplete, mirroring the existing fallback in getSourceRootInfo(). A
FailedStorage guard keeps a deleted owner/offline storage safely on
NullWatcher.

Fixes nextcloud#63253

Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: Pavel Dostál <pdostal@suse.cz>
@pdostal
pdostal requested a review from a team as a code owner August 14, 2026 23:56
@pdostal
pdostal requested review from Altahrim, CarlSchwan, icewind1991 and provokateurin and removed request for a team August 14, 2026 23:56
@solracsf solracsf added this to the Nextcloud 35 milestone Aug 16, 2026
@solracsf solracsf added bug 3. to review Waiting for reviews feature: external storage AI assisted community pull requests from community labels Aug 16, 2026
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-shared external storage (SMB) not always rescanned for recipients

2 participants